import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '所属任务',
    align: "center",
    dataIndex: 'taskId_dictText'
  },
  {
    title: '检查类型',
    align: "center",
    dataIndex: 'checkType_dictText'
  },
  // {
  //   title: '是否停产整顿',
  //   align: "center",
  //   dataIndex: 'resultStatus_dictText'
  // },
  {
    title: '检查序号',
    align: "center",
    dataIndex: 'checkName'
  },
  {
    title: '检查内容',
    align: "center",
    dataIndex: 'checkContent'
  },
  {
    title: '检查方式',
    align: "center",
    dataIndex: 'checkWay'
  },
  {
    title: '检查依据',
    align: "center",
    dataIndex: 'checkBasis'
  },
  {
    title: '适用场合',
    align: "center",
    dataIndex: 'applicablePlace'
  },
  {
    title: '检查人',
    align: "center",
    dataIndex: 'examiner_dictText'
  },
  {
    title: '是否符合',
    align: "center",
    dataIndex: 'isConforms_dictText'
  },
  {
    title: '检查日期',
    align: "center",
    dataIndex: 'checkDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  // {
  //   title: '删除标记',
  //   align: "center",
  //   dataIndex: 'deleted_dictText'
  // },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "所属任务",
    field: 'taskId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_check_task,task_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "检查类型",
    field: 'checkType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "baseCheckType"
    },
    //colProps: {span: 6},
  },
  {
    label: "检查日期",
    field: "checkDate",
    component: 'RangePicker',
    //colProps: {span: 6},
  },
  {
    label: "是否停产整顿",
    field: 'resultStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
    //colProps: {span: 6},
  },
  {
    label: "检查内容",
    field: 'checkContent',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "检查方式",
    field: 'checkWay',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "检查依据",
    field: 'checkBasis',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "适用场合",
    field: 'applicablePlace',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "检查人",
    field: 'examiner',
    component: 'JSelectUserByDept',
    //colProps: {span: 6},
  },
  {
    label: "是否符合",
    field: 'isConforms',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "isConforms"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '所属任务',
    field: 'taskId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_check_task,task_name,id"
    },
  },
  {
    label: '检查类型',
    field: 'checkType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "baseCheckType"
    },
  },
  {
    label: '检查日期',
    field: 'checkDate',
    component: 'DatePicker',
  },
  {
    label: '是否停产整顿',
    field: 'resultStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
  {
    label: '检查序号',
    field: 'checkName',
    component: 'Input',
    dynamicDisabled: true
  },
  {
    label: '检查内容',
    field: 'checkContent',
    component: 'InputTextArea',
  },
  {
    label: '检查方式',
    field: 'checkWay',
    component: 'Input',
  },
  {
    label: '检查依据',
    field: 'checkBasis',
    component: 'Input',
  },
  {
    label: '适用场合',
    field: 'applicablePlace',
    component: 'Input',
  },
  {
    label: '检查人',
    field: 'examiner',
    component: 'JSelectUserByDept',
    componentProps:{
      labelKey: 'realname',
    },
  },
  {
    label: '是否符合',
    field: 'isConforms',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "isConforms"
    },
  },
  {
    label: '删除标记',
    field: 'deleted',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  taskId: {title: '所属任务',order: 0,view: 'list', type: 'string',dictTable: 'tb_base_check_task', dictCode: 'id', dictText: 'task_name',},
  checkType: {title: '检查类型',order: 1,view: 'list', type: 'string',dictCode: 'baseCheckType',},
  checkDate: {title: '检查日期',order: 2,view: 'date', type: 'string',},
  resultStatus: {title: '是否停产整顿',order: 3,view: 'radio', type: 'string',},
  checkName: {title: '检查序号',order: 4,view: 'text', type: 'string',},
  checkContent: {title: '检查内容',order: 5,view: 'textarea', type: 'string',},
  checkWay: {title: '检查方式',order: 6,view: 'text', type: 'string',},
  checkBasis: {title: '检查依据',order: 7,view: 'text', type: 'string',},
  applicablePlace: {title: '适用场合',order: 8,view: 'text', type: 'string',},
  examiner: {title: '检查人',order: 9,view: 'sel_user', type: 'string',},
  isConforms: {title: '是否符合',order: 10,view: 'radio', type: 'string',},
  deleted: {title: '删除标记',order: 11,view: 'radio', type: 'string',},
};
